﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Model;
using DataAccess.SqlClient;
using System.Data;
using System.Data.SqlClient;
namespace DAL
{
   public class InServicesDAL
    {

        /// <summary>
        /// 全部部分服务类型
        /// </summary>
        /// <returns></returns>
       public static dynamic InServiceTypeShow()
        {
            SqlQuery q = new SqlQuery
            {
                CommandText = "select * from InServiceType",
            };
            var dt = SqlDataAccess.ExecDataset(q).Tables[0];//连接数据库，获取全部部分服务类型
            var list = new List<dynamic>();
            foreach (var dr in dt.Select())
            {
                list.Add(

                    new
                    {
                        ServiceTID = dr.Field<Guid>("ServiceTID"),
                        SType = dr.Field<string>("SType"),
                    }
                    );
            }
            return list;
        }

        /// <summary>
       /// 服务查询信息
        /// </summary>
        /// <returns></returns>
       public static dynamic InServicesshow()
        {
            SqlQuery q = new SqlQuery
            {
                CommandText = "select * from InServices where ServiceTID=@ServiceTID",
            };
            var dt = SqlDataAccess.ExecDataset(q).Tables[0];//连接数据库，获取服务查询信息
            var list = new List<dynamic>();
            foreach (var dr in dt.Select())
            {
                list.Add(

                    new
                    {

                        ServiceTID = dr.Field<Guid>("ServiceTID"),
                        SType = dr.Field<string>("SType"),
                        ServicesID = dr.Field<Guid>("ServicesID"),
                        Title = dr.Field<string>("Title"),
                        Content = dr.Field<string>("Content"),
                        serviceimage = dr.Field<string>("serviceimage"),
                    }
                    );
            }
            return list;
        }
    }
}
